<!DOCTYPE html>
<html lang="zh-CN">
<head>
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1">
<title>自动化立体库</title>
<link rel="stylesheet" href="css/style.css">
<!-- Bootstrap -->
<link href="css/bootstrap.min.css" rel="stylesheet">
  <!--<script src="http://apps.bdimg.com/libs/jquery/2.1.4/jquery.min.js"></script>-->
  <script src="js/json.js"></script>
<!-- Stylesheet -->
</head>
<body style="background: #F7F4F8">
  <div class="logo">
    <img src="images/img_logo.png" alt="" width="50">
  </div>
  <div class="link-btn">
    <a class="link-item" href="index.html">
      仓库管理系统
    </a>
    <a class="link-item" href="index.html#s2">
      解决方案
    </a>
    <a class="link-item" href="index.html#s3">
      周边设备
    </a>
    <a class="link-item on" href="index.html#s4">
      案例
    </a>
  </div>
  <div class="nav-bg-inner">
    <img src="images/bg_text_2.png" class="wow fadeInDown">
  </div>
  <div class="section container" id="container">
  </div>
  </div>
  <div class="footer">
      <div id="copyright" class="container section">
      </div>
    </div>
  <!-- JavaScript -->
  <script src="https://cdn.bootcss.com/jquery/1.12.4/jquery.min.js"></script>
<script>
  $(function(){
    getCaseData()
    document.getElementById("copyright").innerHTML=json.Copyright
    // 点击分类标题切换问题列表
    $('.apply').click(function () {
      $(this).addClass('selected').siblings('p').removeClass('selected');
      $('.subnav').hide();
      var html_y = '';
      for (var i = 0; i < json.case.industry.length; i++) {
        html_y += '<p class="col-xs-3 col-sm-3">'+json.case.industry[i]+'</p>'
      }
      $('#item-container').html(html_y)
    })
    $('.successCase').click(function () {
      $(this).addClass('selected').siblings('p').removeClass('selected');
      $('.subnav').show();
      // url中id处理
      if (getUrlParam("cNum")) {
        var cNum = parseInt(getUrlParam("cNum"))
      }
      var html_sc = ''
      $(this).addClass('selected').siblings('p').removeClass('selected');
        html_sc += '<h3>'+json.case.example[cNum].name+'</h3>';
        for (var j = 0; j < json.case.example[cNum].img.length; j++) {
          html_sc += '<img src="'+'images/case/'+json.case.example[cNum].img[j]+'">';
        }
      $('#item-container').html(html_sc)
    })
  })
  function getCaseData() {
    // url中id处理
    if (getUrlParam("cNum")) {
      var cNum = parseInt(getUrlParam("cNum"))
    }
    // url中id处理
    // console.log('cNum', cNum)
    var html_c = '';
    html_c += '<div class="item-nav">';
    html_c += '<p class="selected successCase">' + json.case.title + '</p>';
    html_c += '<ul class="subnav">';
    for (var i = 0; i < json.case.example.length; i++) {
      if (i===cNum) {
        html_c += '<li class="subnav_on" num="'+i+'">'+json.case.example[i].name+'</li>';
      } else {
        html_c += '<li num="'+i+'">'+json.case.example[i].name+'</li>';
      }
    }
    html_c += '</ul>'
    html_c += '<p class="apply">' + json.case.apply + '</p>';
    html_c += '</div>';
    html_c += '<div class="item-container" id="item-container">';
    html_c += '<h3>'+json.case.example[cNum].name+'</h3>';
    for (var j = 0; j < json.case.example[cNum].img.length; j++) {
      html_c += '<img src="'+'images/case/'+json.case.example[cNum].img[j]+'">';
    }
    html_c += '</div>';
    $('#container').html(html_c)

    
    $('.subnav li').click(function () {
      $(this).addClass('subnav_on').siblings('li').removeClass('subnav_on');
      var cNumTmp = parseInt($(this).attr('num'));
      location.href='case.html?cNum=' + cNumTmp;
      // $('#container .item-container').html(list);
      var html_subCtn = ''
      $(this).addClass('selected').siblings('p').removeClass('selected');
        html_subCtn += '<h3>'+json.case.example[cNumTmp].name+'</h3>';
        for (var j = 0; j < json.case.example[cNumTmp].img.length; j++) {
          html_subCtn += '<img src="'+'images/case/'+json.case.example[cNumTmp].img[j]+'">';
        }
      $('#item-container').html(html_subCtn)
    })
  }
</script>
</body>
</html>